﻿// <copyright file="Storage.cs" company="City of Portland, BES-ASM">
// </copyright>
// <summary>Storage class</summary>

namespace BESASM.EMGAATS.BusinessClasses
{
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;

  /// <summary>
  /// Storage class
  /// </summary>
  public class Storage : Entity, IStorage
  {
    /// <summary>
    /// Initializes a new instance of the <see cref="Storage"/> class
    /// </summary>
    /// <param name="id">The ID of the Storage object</param>
    public Storage(int id) :
      base(EntityType.Storage, id)
    {
      this.StorageName = string.Empty;
    }

    /// <summary>
    /// Gets or sets the name of the Storage
    /// </summary>
    public string StorageName { get; set; }

    /// <summary>
    /// Gets or sets the node to which the Storage is attached
    /// </summary>
    public INode Node { get; set; }

    /// <summary>
    /// Gets or sets the area per ft of depth (in square feet)
    /// </summary>
    public double AreaSqFtPerFtDepth { get; set; }

    /// <summary>
    /// Gets or sets the invert of the storage node, in feet
    /// </summary>
    public double InvertElevFt { get; set; }

    /// <summary>
    /// Creates a new Storage that is a copy of the current instance
    /// </summary>
    /// <returns>A new Storage that is a shallow copy of this instance</returns>
    public override object Clone()
    {
      // Simple properties and references
      // DO NOT copy Network, clones must be added to a network
      Storage clone = new Storage(this.Id);

      clone.StorageName = this.StorageName;
      clone.Node = this.Node;
      clone.AreaSqFtPerFtDepth = this.AreaSqFtPerFtDepth;
      clone.InvertElevFt = this.InvertElevFt;

      return clone;
    }

    /// <summary>
    /// Returns a string representation of this Storage
    /// </summary>
    /// <returns>The string representation of this Storage</returns>
    public override string ToString()
    {
      if (this.Node != null)
      {
        return string.Format("Sto{0}/{2} (N{1})", this.Id, this.Node, this.StorageName);
      }
      else
      {
        return string.Format("Sto{0}/{1}", this.Id, this.StorageName);
      }
    }
  }
}
